<script>
    var ExcelExport = {
        data: {
            ExcelDiagFlag:false,
            ExcelName:'',
            ExcelCreateComplete:false,
            ExcelUrl:'',
            ExcelFileName:'',
            ExportTitle:''
        }
        ,methods:{
            showExcelDialog(title,type){
                this.ExcelCreateComplete = false
                this.ExcelDiagFlag = true
                this.ExportTitle = title
                this.ExcelExportParam.type = type
                this.ExcelName = title.replace('导出','')
            },
            ExcelConfirm(){
                let param = this.ExcelExportParam
                    param.filename = this.ExcelName

                if (param.status_ids == 'B2') {
                    param.status_ids = 'C1,C2,D1,D2,D3,E1,E2,E3,F1,F2,F3,G1,G2,G3,H1,I1,J1'
                }

                loading('正在创建excel文件,请稍等...')
                axios.post('/api/admin/excel-export',this.ExcelExportParam)
                .then(response => {
                    if (response.data.ok) {
                        this.ExcelCreateComplete = true
                        this.ExcelFileName = response.data.fileName+'.xls'
                        this.ExcelUrl = response.data.url+'.xls'
                        success('创建完成');

                    } else {
                        error('操作失败: ' + response.data.msg)
                    }
                    setTimeout(function () {
                        dismiss()
                    },1500)
                })
            },
            ExcelOk(){
                this.ExcelCreateComplete = false
                this.ExcelFileName = ''
                this.ExcelUrl = ''
                this.ExcelDiagFlag = false
            }
        }
    }
</script>